// 页面路径：store/index.js 
import Vue from 'vue'
import Vuex from 'vuex'

import persistedState from 'vuex-persistedstate'

Vue.use(Vuex); //vue的插件机制

import user from './modules/user.js'



//Vuex.Store 构造器选项
export default new Vuex.Store({
	modules: {
		user
	},
	/* vuex数据持久化配置 */
	plugins: [
		persistedState({
			storage:{
				getItem(key) {
					uni.getStorageSync(key)
				},
				setItem(key,value) {
					uni.setStorageSync(key,value)
				},
				removeItem(key) {
					uni.removeStorageSync(key)
				}
			}
		})
	]
})